package cn.dujc.superkid.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * @author du
 * date 2018/8/2 下午9:00
 */
public class CupIndexResult implements Parcelable{
    /**
     * id : 1
     * gname : 一年级
     * sorting : 10
     * cup : [{"id":8,"cup_name":"数学大王","clist":[{"id":460,"title":"第25届一年级数学大王邀请赛（2016年）","posttime":1490060179},{"id":459,"title":"第24届一年级数学大王邀请赛（2015年）","posttime":1501404181}]}]
     */

    private String id;//年级id
    private String gname;//年级名
    private String sorting;//排序
    private List<CupEntity> cup;//杯赛列表

    public String getId() { return id;}

    public void setId(String id) { this.id = id;}

    public String getGname() { return gname;}

    public void setGname(String gname) { this.gname = gname;}

    public String getSorting() { return sorting;}

    public void setSorting(String sorting) { this.sorting = sorting;}

    public List<CupEntity> getCup() { return cup;}

    public void setCup(List<CupEntity> cup) { this.cup = cup;}

    @Override
    public int describeContents() { return 0; }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.gname);
        dest.writeString(this.sorting);
        dest.writeTypedList(this.cup);
    }

    public CupIndexResult() {}

    protected CupIndexResult(Parcel in) {
        this.id = in.readString();
        this.gname = in.readString();
        this.sorting = in.readString();
        this.cup = in.createTypedArrayList(CupEntity.CREATOR);
    }

    public static final Creator<CupIndexResult> CREATOR = new Creator<CupIndexResult>() {
        @Override
        public CupIndexResult createFromParcel(Parcel source) {return new CupIndexResult(source);}

        @Override
        public CupIndexResult[] newArray(int size) {return new CupIndexResult[size];}
    };

    public static class CupEntity implements Parcelable{
        /**
         * id : 8
         * cup_name : 数学大王
         * clist : [{"id":460,"title":"第25届一年级数学大王邀请赛（2016年）","posttime":1490060179},{"id":459,"title":"第24届一年级数学大王邀请赛（2015年）","posttime":1501404181}]
         */

        private String id;//杯赛id
        private String cup_name;//杯赛知识点
        private List<ClistEntity> clist;//杯赛知识点列表

        public String getId() { return id;}

        public void setId(String id) { this.id = id;}

        public String getCup_name() { return cup_name;}

        public void setCup_name(String cup_name) { this.cup_name = cup_name;}

        public List<ClistEntity> getClist() { return clist;}

        public void setClist(List<ClistEntity> clist) { this.clist = clist;}

        @Override
        public int describeContents() { return 0; }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.id);
            dest.writeString(this.cup_name);
            dest.writeTypedList(this.clist);
        }

        public CupEntity() {}

        protected CupEntity(Parcel in) {
            this.id = in.readString();
            this.cup_name = in.readString();
            this.clist = in.createTypedArrayList(ClistEntity.CREATOR);
        }

        public static final Creator<CupEntity> CREATOR = new Creator<CupEntity>() {
            @Override
            public CupEntity createFromParcel(Parcel source) {return new CupEntity(source);}

            @Override
            public CupEntity[] newArray(int size) {return new CupEntity[size];}
        };
    }

    public static class ClistEntity implements Parcelable{
        /**
         * id : 460
         * title : 第25届一年级数学大王邀请赛（2016年）
         * posttime : 1490060179
         */

        private String id;//杯赛id
        private String title;//杯赛知识点标题
        private String posttime;//杯赛知识点添加时间

        public String getId() { return id;}

        public void setId(String id) { this.id = id;}

        public String getTitle() { return title;}

        public void setTitle(String title) { this.title = title;}

        public String getPosttime() { return posttime;}

        public void setPosttime(String posttime) { this.posttime = posttime;}

        @Override
        public int describeContents() { return 0; }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.id);
            dest.writeString(this.title);
            dest.writeString(this.posttime);
        }

        public ClistEntity() {}

        protected ClistEntity(Parcel in) {
            this.id = in.readString();
            this.title = in.readString();
            this.posttime = in.readString();
        }

        public static final Creator<ClistEntity> CREATOR = new Creator<ClistEntity>() {
            @Override
            public ClistEntity createFromParcel(Parcel source) {return new ClistEntity(source);}

            @Override
            public ClistEntity[] newArray(int size) {return new ClistEntity[size];}
        };
    }

}
